package com.huitu.whht.api.core.common.JerseyConfig;

import com.huitu.whht.api.core.common.util.JerseyUtil;
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.filter.CorsFilter;

public class JerseyConfigCore extends ResourceConfig {

    private static final String findClassPath = "com.huitu.whht.framework.szy.core.api.*";

    private static JerseyUtil jerseyUtil = new JerseyUtil();

    public JerseyConfigCore() {
        registerClasses(jerseyUtil.findAllClasses(findClassPath));
        // 注册日志
        register(LoggingFeature.class);
        // 异常处理
        register(ExceptionHandler.class);
        // 跨域过滤器注册
        register(CorsFilter.class);
    }

}
